<?php

require_once('include.php');
require_once('util.php');

$command = $_REQUEST['cmd'];

switch ($command) {
  case 'insert' :
    runquery ("INSERT INTO ".$_POST['table']." (`latitude`,`longitude`) VALUES('".$_POST['latitude']."','".$_POST['longitude']."')");
    print "Values hopefully inserted.";
  break;
  case 'search' :
    $columns = runquery ("SELECT * FROM ".$_POST['table']);
    foreach ($columns as $row) {
	/*foreach ($row as $col) { 
	  print $col;
          print " ";
	}*/
        print $row['latitude'].", ". $row['longitude'];
	print "<br>\n";
    }
  break;
}

?>